package com.qfedu.zf.index.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qfedu.zf.common.vo.R;
import com.qfedu.zf.index.entity.Images;
import com.qfedu.zf.index.mapper.ImagesMapper;
import com.qfedu.zf.index.service.ImagesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.*;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 图片表 服务实现类
 * </p>
 *
 * @author wgz
 * @since 2024-06-16
 */
@Service
public class ImagesServiceImpl extends ServiceImpl<ImagesMapper, Images> implements ImagesService {

    @Autowired
    ImagesMapper imagesMapper;

    @Override
    public R listingsImage(Map<String, Object> map) {
        if (map.get("listingId") == null){
            return R.fail("参数异常");
        }
        QueryWrapper<Images> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("listing_id",Integer.parseInt((String) map.get("listingId")));
        List<Images> imagesList = imagesMapper.selectList(queryWrapper);
        return R.ok(imagesList);
    }
}
